QUERY PLAN Nested Loop (cost=27.04..4711.39 rows=1 width=368) Join Filter: (("outer".co_empresa = ("inner".co_empresa)::numeric) AND ("outer".co_filial = "inner".co_filial) AND ("outer".co_clase = ("inner".co_clase)::numeric)) -> Nested Loop (cost=27.04..4710.10 rows=1 width=353) Join Filter: ("outer".co_cuentamayor = ("inner".co_cuentamayor)::numeric) -> Nested Loop (cost=27.04..4702.68 rows=1 width=624) Join Filter: (("outer".co_grupo = "inner".co_grupo) AND ("outer".co_clase = "inner".co_clase) AND ("outer".co_filial = "inner".co_filial) AND ("outer".co_empresa = "inner".co_empresa) AND ("outer".co_subgrupo = ("inner".co_subgrupo)::numeric)) -> Nested Loop (cost=27.04..4698.16 rows=1 width=534) Join Filter: ("outer".co_rubro = ("inner".co_rubro)::numeric) -> Nested Loop (cost=27.04..4691.82 rows=1 width=449) Join Filter: ((("inner".co_empresa)::numeric = "outer".co_empresa) AND (("inner".co_filial)::numeric = "outer".co_filial) AND (("inner".co_clase)::numeric = "outer".co_clase) AND (("inner".co_grupo)::numeric = "outer".co_grupo) AND (("inner".co_subgrupo)::numeric = "outer".co_subgrupo) AND (("inner".co_rubro)::numeric = "outer".co_rubro) AND (("inner".co_cuentamayor)::numeric = "outer".co_cuentamayor) AND ("inner".co_subcuentamayor = ("outer".co_subcuentamayor)::numeric) AND (("inner".co_subcuentamayor)::numeric = "outer".co_subcuentamayor) AND (("inner".co_cuentadetalle)::numeric = "outer".co_cuentadetalle) AND ("inner".co_subcuentadetalle = "outer".co_subcuentadetalle) AND ("inner".co_grupo = ("outer".co_grupo)::numeric) AND ("inner".co_cuentadetalle = ("outer".co_cuentadetalle)::numeric)) -> Nested Loop (cost=27.04..212.34 rows=1 width=404) -> Nested Loop (cost=27.04..73.14 rows=8 width=279) -> Merge Join (cost=27.04..31.61 rows=7 width=178) Merge Cond: (("outer"."?column6?" = "inner".co_empresa) AND ("outer".co_filial = "inner".co_filial) AND ("outer".co_clase = "inner".co_clase)) -> Sort (cost=2.29..2.38 rows=36 width=68) Sort Key: (grupo.co_empresa)::numeric, grupo.co_filial, grupo.co_clase -> Seq Scan on grupo (cost=0.00..1.36 rows=36 width=68) -> Sort (cost=24.75..25.56 rows=324 width=110) Sort Key: subcuentamayor.co_empresa, subcuentamayor.co_filial, subcuentamayor.co_clase -> Seq Scan on subcuentamayor (cost=0.00..11.24 rows=324 width=110) -> Index Scan using cuentadetalle_pk_cuantadetalle on cuentadetalle (cost=0.00..5.90 rows=1 width=101) Index Cond: ((cuentadetalle.co_empresa = ("outer".co_empresa)::numeric) AND (cuentadetalle.co_filial = "outer".co_filial) AND (cuentadetalle.co_clase = "outer".co_clase) AND (cuentadetalle.co_grupo = "outer".co_grupo) AND (cuentadetalle.co_subgrupo = "outer".co_subgrupo) AND (cuentadetalle.co_rubro = "outer".co_rubro) AND (cuentadetalle.co_cuentamayor = "outer".co_cuentamayor)) -> Index Scan using subcuentadetalle_pk_cuentadetalle on subcuentadetalle (cost=0.00..17.28 rows=4 width=125) Index Cond: ((subcuentadetalle.co_empresa = ("outer".co_empresa)::numeric) AND (subcuentadetalle.co_filial = "outer".co_filial) AND (subcuentadetalle.co_clase = "outer".co_clase) AND (subcuentadetalle.co_grupo = "outer".co_grupo) AND (subcuentadetalle.co_subgrupo = "outer".co_subgrupo) AND (subcuentadetalle.co_rubro = "outer".co_rubro) AND (subcuentadetalle.co_cuentamayor = "outer".co_cuentamayor) AND (subcuentadetalle.co_subcuentamayor = ("outer".co_subcuentamayor)::numeric)) -> Seq Scan on activos (cost=0.00..2931.58 rows=30958 width=118) -> Index Scan using rubro_new_pk_rubro on rubro (cost=0.00..6.30 rows=1 width=89) Index Cond: ((rubro.co_empresa = ("outer".co_empresa)::numeric) AND (rubro.co_filial = "outer".co_filial) AND (rubro.co_clase = "outer".co_clase) AND ("outer".co_grupo = rubro.co_grupo) AND ("outer".co_subgrupo = rubro.co_subgrupo)) -> Seq Scan on subgrupo (cost=0.00..2.72 rows=72 width=94) -> Index Scan using cuentamayor_new_pk_cuentamayor on cuentamayor (cost=0.00..7.37 rows=2 width=97) Index Cond: ((cuentamayor.co_empresa = ("outer".co_empresa)::numeric) AND (cuentamayor.co_filial = "outer".co_filial) AND (cuentamayor.co_clase = "outer".co_clase) AND (cuentamayor.co_grupo = "outer".co_grupo) AND (cuentamayor.co_subgrupo = "outer".co_subgrupo) AND ("outer".co_rubro = cuentamayor.co_rubro)) -> Seq Scan on clase (cost=0.00..1.09 rows=9 width=33)